package chapter7.No7_1_线程的状态.a验证NEW_RUNNABLE和TERMINATED.d2_验证RUNNABLE;

/**
 * ! 验证RUNNABLE
 *
 * @author liujian
 * @version 2016/12/8 0008
 */
public class Main {

    static class MyThread extends Thread {
        @Override
        public void run() {
            System.out.println("开始执行RUN：" + System.currentTimeMillis());
            while(!this.isInterrupted()) {
            }
            System.out.println("结束执行RUN：" + System.currentTimeMillis());
        }
    }

    public static void main(String[] args) throws InterruptedException {
        MyThread a = new MyThread();
        a.start();
        Thread.sleep(100);
        System.out.println("线程的状态：" + a.getState());
        Thread.sleep(1000);
        a.interrupt();
        System.out.println("线程停止");
    }

}
